<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/axios.min.js"></script>
    <script src="/js/query.js"></script>
    <script>
        window.onload = function () {
            var info = getQuery("errorInfo");
            if (info != null && info == "noland") {
                $("errorDiv").innerHTML = "请登录"
            }
        }

        // function land() {
        //     axios.get("/user/login", {
        //         params: {
        //             userName: $("userName").value,
        //             pwd: $("pwd").value
        //         }
        //     }).then(resp => {
        //         var info = resp.data;
        //         if (info == "ok") {
        //             location.href = "/index.html";
        //         } else {
        //             $("errorDiv").innerHTML = "登录失败";
        //         }
        //     })
        // }

        function land(){
            axios.get("/user/login",{
                params:{
                    userName:$("userName").value,
                    pwd:$("pwd").value
                }
            }).then(resp =>{
                var info = resp.data;
                if(info == "ok"){
                    location.href = "/index.html";
                }
                else{
                    $("errorDiv").innerHTML = "登陆失败";
                }
            })
        }
    </script>
</head>
<body>
<div id="errorDiv"></div>
用户名：<input type="text" id="userName"><br>
密码：<input type="text" id="pwd"><br>
<input type="button" value="登录" onclick="land()">
</body>
</html>